The Runtime: GNARL

The most important activities of the run-time have to do with task management: creation, activation, rendez-vous, termination. The runtime maintains the data structures needed to manage, schedule, and synchronize tasking activities. In order to make GNAT easily portable, the runtime is written in Ada (with some very small assembly glue) and two procedural interfaces, GNARLI and GNULLI, are used to isolate the compiler from the runtime, and the runtime from the underlying operating system.

GNARLI (GNAT run-time library interface) is the interface between the compiler and the run-time. Each Ada construct that applies to tasks or protected objects is implemented by one or more subprograms in the run-time. The expander transforms each occurrence of such constructs into the corresponding series of calls. The packages that constitute the run-time are treated as any other unit of the context of the compilation, and analyzed when needed. This obviates the need to place run-time information in the compiler itself, and allows a knowledgeable user to modify the run-time if he/she so chooses. The design of GNARL is based on the CARTS (Common Ada Run-Time System) specification~[#gnarl##1###].

GNULLI (GNAT low-level library interface) provides the interface between the run-time and the underlying operating system. The design of GNULLI makes use of a few POSIX threads primitives, and assumes the existence of such primitives in the host OS. A threads package that emulates those primitives is supplied for systems that do not have them, e.g. conventional Unix systems. Otherwise the implementation of GNULLI is straightforward on modern operating systems such as Solaris, Mach and OS/2.
The design and implementation of GNARL have been carried out at Florida State University by the group directed by Ted Baker and Ted Giering, and follows their design of previous protable Ada runtimes, notably CARTS and MRTSI.